import pyglet
import cocos
from cocos.director import director
import cocos.actions as ac

class SplashScene(cocos.scene.Scene):
    def __init__(self):
        super(SplashScene, self).__init__()
        image = pyglet.resource.image('splash.jpg')
        sp = cocos.sprite.Sprite(image)
        w, h = director.get_window_size()
        sp.position = (w//2, h//2)
        self.add(sp)

    def on_enter(self):
        super(SplashScene, self).on_enter()
        self.do(ac.Delay(0.1)+ac.CallFunc(self.end))

    def end(self):
##        import main_menu_scene
##        scene = main_menu_scene.get_scene()
##        director.replace(scene)
        from game_scene import get_scene
        scene = get_scene(0) #1st scene
        director.push(scene)

def get_scene():
    scene = SplashScene()
    return scene


    
